﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyWebPagesStarterKit;

public partial class UserControls_HeaderImage : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Literal image = new Literal();
        string data = "<img src=\"/ImageHandler.ashx?UploadedFile=true&pg={0}&image=~/App_Data/UserImages/image/HeaderImages/{1}\" alt=\"{1}\" />";

        try
        {
            WebPage _page = WebPage.Current;
            if (!string.IsNullOrEmpty(_page.HeaderImage))
            {
                image.Text = string.Format(data, _page.PageId, _page.HeaderImage);
                this.Controls.Add(image);
            }
        }
        catch{}
    }
}
